﻿@model EraNet.Core.Model.Account.Member
@{
    Layout = "~/Areas/LMS/Views/Shared/_parentLayOut.cshtml";
}

<script type="text/javascript">
    //回车时，默认是登陆
    function on_return(event) {
        var e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            Register();
        }
    }

    function Register() {
        var name = $("#txt_name").val();
        var idCard = $("#txt_idCard").val();
        var phone = $("#txt_phone").val();
        var yzm = $("#yzm").val();
        var schoolId = $("#ddl_School").val();
        var LearnCar = $("#txt_LearnCar").val();
        var data = "&name=" + name + "&idCard=" + idCard + "&phone=" + phone + "&yzm=" + yzm + "&LearnCar=" + LearnCar + "&schoolId=" + schoolId;
        $.ajax({
            async: false,
            type: "POST",
            url: "/Account/AjaxUserRegister",
            dataType: "json",
            data: data,
            success: function (data) {
                switch (data) {
                    case "1": alert("姓名不能为空！"); reloadcode_stu();
                        break;
                    case "2": alert("身份证不能为空！"); reloadcode_stu();
                        break;
                    case "3": alert("联系电话不能为空！"); reloadcode_stu();
                        break;
                    case "4": alert("验证码不能为空！"); reloadcode_stu();
                        break;
                    case "5": alert("验证码错误！"); reloadcode_stu();
                        break;
                    case "6": alert("该卡生成的用户名已存在！"); reloadcode_stu();
                        break;
                    case "7": alert("该卡生成的用户名已存在！"); reloadcode_stu();
                        break;
                    case "8": alert("用户注册成功！"); location.href = "/Account/Infos";
                        break;
                    case "9": alert("用户注册失败！"); reloadcode_stu();
                        break;
                    case "10": alert("身份证至少是15位或18位整数。！"); reloadcode_stu();
                        break;
                    case "11": alert("联系电话格式不正确。！"); reloadcode_stu();
                        break;
                    case "12": alert("学习车型不能为空。！"); reloadcode_stu();
                        break;
                    default: alert("登录失败!"); reloadcode_stu();
                        break;
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('请求出现异常，请稍后再试'); reloadcode_stu();
            }

        });
    }
</script>

<body  onkeydown="on_return(event);">
<header id="top">
<div class="wrapper-login">
<div id="title"><img src="/styles/img/logo.png" alt="Administry" /></div>
<nav id="menu">
<ul class="sf-menu">
<li class="current" ><a href="###">用户注册</a></li>
</ul>
</nav>
<aside><a href="#">在线客服</a> &middot; <a href="#">说明</a></aside>
</div>
</header>
<div >
<div id="pagetitle">
<div class="wrapper-login"></div>
</div>
<div id="page">
<div id="mup_lg" class="wrapper-login">
<div class="full">					
<h3>用户注册</h3>
<div class="box box-info">输入您的真实的个人信息进行注册！<br />如资料有误，可能会影响您后续的使用！<br /></div>
<div id="mlogin">
@if (Convert.ToInt32(ViewData["getType"]) == 1)
{
    <p>
    <label class="required" for="name">所属驾校:</label><br/>
    @Html.DropDownList("ddl_School", (SelectList)ViewData["schools"])
    </p>
}
<p>
<label class="required" for="name">姓名:</label><br/>
<input type="text" id="txt_name" class="full" value="" name="name"/>
</p>
<p>
<label class="required" for="idCard">身份证:</label><br/>
<input type="text" id="txt_idCard" class="full" value="" name="idCard"/>
</p>
<p>
<label class="required" for="phone">联系电话:</label><br/>
<input type="text" id="txt_phone" class="full" value="" name="phone"/>
</p>
<p>
<label class="required" for="phone">学习车型:</label><br/>
<input type="text" id="txt_LearnCar" class="full" value="" name="LearnCar"/>
</p>
<p>
<label class="required" for="yam">验证码:</label><br/>
<input type="text" id="yzm" name="yzm" class="loginyzm"/>
<img alt="验证码" id="Img1" class="yzmimg" src="@Url.Action("CreateImageCode", "SecurityCode")" onclick="reloadcode_stu()"  />
<script type="text/javascript">
function reloadcode_stu() {
var verify = document.getElementById('Img1');
verify.setAttribute('src', '@Url.Content("~/SecurityCode/CreateImageCode?")' + Math.random());
}
$(function () {
$("#Img1").click();
});
</script>
</p>

<div class="clear">&nbsp;</div>
</div>
<input type="button" class="btn btn-green big" value="注册" onclick="Register()" />
</div> 
</div>
</div>
</div>
</body>
